package com.share.finance.collection.core.web;

import com.share.common.common.Page;
import com.share.common.common.Result;
import com.share.finance.collection.core.model.db.OverdueInfo;
import com.share.finance.collection.core.model.vo.CallPhoneVo;
import com.share.finance.collection.core.model.vo.LoanCasePageReq;
import com.share.finance.collection.core.service.IOverdueInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 放款记录表  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-08-21
 */
@RestController
@RequestMapping("/overdue")
public class OverdueInfoController {
    @Autowired
    private IOverdueInfoService overdueInfoService;

    @ApiOperation(value = "拉取逾期数据")
    @RequestMapping(value = "/pullOverdueData")
    public Result pullOverdueData(Long id) {
        int count = overdueInfoService.pullOverdueData(id);
        return Result.success(count);
    }

    @ApiOperation(value = "分页列表")
    @RequestMapping(value = "/pageList")
    public Result<Page<OverdueInfo>> pageList(LoanCasePageReq req) {
        Page<OverdueInfo> page = overdueInfoService.pageList(req);
        return Result.success(page);
    }

    @ApiOperation(value = "打电话")
    @RequestMapping(value = "/callPhone")
    public Result callPhone(CallPhoneVo req) {
        return Result.insertOrDeleteOrUpdate(overdueInfoService.callPhone(req));
    }
}
